<template>
    <div class="shangp">
        <div class="dangneir" v-for="(item,index) in shuzu" :key="index"> 
        <div class="title_shangp">
            商品描述<img style="float:right" height="13px" src="../assets/images/jiantou.png" alt="">
        </div>
        <div class="neir">
            <div class="l"><img src="../assets/images/物流单.png" alt=""></div>
            <div class="r">
                <p>{{item.title}}</p>
                <p><span>下单时间</span>{{item.orderTime}}</p>
                <p><span>下单人</span>{{item.orderUserName}}</p>
            </div>
        </div>
        <div class="pj">
            <van-button v-if="item.status==30" round type="info" color="#ffcc33" @click="chakan(item.serialNo)">查看评价</van-button>
            <van-button v-if="item.status==20" round type="info" color="#ffcc33" @click="chakan(item.serialNo)">评价</van-button>
            <van-button v-if="item.status==10" round type="info" color="#003399" plain @click='xianshi(item.serialNo,index)'>收货</van-button>
            <van-button v-if="item.status==0" round type="info" color="#003399" @click="fahuo(item.serialNo)">发货</van-button>
        </div>
        </div>
        <van-popup v-model="show">
           <div class="model"> 
               <div class="s">是否确认收货？</div>
              <div class="x"> 
               <button class="buttona" @click="quxiao(show=false)">取消</button>
               <button class="buttona" @click="shouhuo">确认收货</button>
               </div>
           </div>
        </van-popup>
    </div>
</template>

<script>
import {qrshouhuo,evaluateInfo} from '../requset/api'
export default {
    props:['shuzu'],
    data () {
        return {
           show:false,
           serialNo:'',
           i:'',
        }
    },
    created(){
        // console.log(this.shuzu);
    },
    methods:{
        xianshi(serialNo,i){
            console.log(123);
            this.show=true
            this.serialNo=serialNo
            this.i=i
        },
        fahuo(danhao){
            this.$router.push('/fahuo/'+danhao)
            console.log(danhao);
        },
        shouhuo(){
            let serialNo=this.serialNo
             qrshouhuo(
                 serialNo
             ).then(res=>{
                 console.log(res);
                 if(res.errCode==0){
                  this.$toast.success('收货成功');
                  this.show=false
                  this.shuzu.splice(this.i,1)
                 }
             })
        },
        chakan(i){
        //  let serialNo=i
        console.log(i);
         this.serialNo=i
        //  evaluateInfo(serialNo).then(res=>{
        //      if(res.errCode==0){
        //        console.log(res);
               this.$router.push('/pj/'+i)
        //      }
        //  })
        }
    }
}
</script>
 
<style lang = "less" scoped>
 .dangneir{
     background: #fff;
      .title_shangp{
        padding: 18px 13px 18px 20px;
        border-bottom: 1px solid #f1f1f1;
        background: #fff;
        margin-top: 10px;
      }
      .neir{
          padding-top: 16px;
          padding-left: 21px;
          padding-bottom: 28px;
          border-bottom: 1px solid #f5f5f5;
          display: flex;
        .l{
            margin-right:15px;
            img{
                width: 60px;
                height: 60px; 
            }
        }
        .r{
            
            p{ 
                span{
                    color: #ccc;
                    margin-right: 12px;
                }
                font-size: 14px;
                margin: 0;
            }
        }
       
      }
      .pj{
          height: 55px;
          padding-right: 13px;
          box-sizing: border-box;
      }
      .van-button{
        height: 30px;
        line-height: 30px;
        padding: 0px 20px;
        float: right;
        margin-top: 10px;
      }
      
 }
 .model{  border-radius: 10px;
          overflow: hidden;
          min-height: 125px;
          width: 260px;
          text-align: center;
          .s{
              height: 81px;
              line-height: 81px;
          }
          .x{
              height: 44px;
              display: flex;
              .buttona{
                height: 44px;
                flex: 1;
                /* height: 100px; */
                border: none;
            } 
          }
      }

       
    
</style>